import 'package:flutter/scheduler.dart';
import 'package:kmxy_base/base/base_package.dart';
import 'package:kmxy_base/page/setting/net_log/net_log_page_view.dart';

abstract class NetLogPageState extends BasePageState<NetLogPage> {
  String log = '';
  ScrollController scrollController = ScrollController();

  clean() {
    setState(() {
      Net.logText = '';
      log = Net.logText;
    });
  }

  @override
  destroyData() {}

  @override
  initData() {
    setState(() {
      log = Net.logText;
    });
    SchedulerBinding.instance?.addPostFrameCallback((_) {
      scrollController.jumpTo(scrollController.position.maxScrollExtent);
    });
  }
}
